package com.twu.biblioteca;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.Buffer;

/**
 * Created by tinamt on 7/23/14.
 */
public class CheckOutAnItem implements Action {
    private Library library;
    LoginManager loginManager;

    CheckOutAnItem(Library library, LoginManager loginManager) {
        this.library = library;
        this.loginManager = loginManager;
    }

    public void execute() throws Exception {
        String nameOfItem;
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        System.out.println("Enter name of the Item you want to borrow");
        nameOfItem = br.readLine();
        library.rentRentalObject(loginManager.currentUser, Integer.parseInt(nameOfItem));
        System.out.println("Thank you! Enjoy!");
    }

    @Override
    public String printActionName() {
        return "Check Out An Item";
    }
}
